package com.onlineauction.beans;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import com.onlineauction.entities.Auction;
import com.onlineauction.entities.Bid;
import com.onlineauction.entities.Item;
import com.onlineauction.entities.User;

public class AuctionBean implements Serializable
{
	private static final long serialVersionUID = 4541852569007727437L;
	
	private Long itemID;
	private Item item;
	
	public Long getItemID() 
	{
		return itemID;
	}
	
	public void setItemID(Long itemID) 
	{
		this.itemID = itemID;
		item = new Item(itemID);
	}
	
	public String getItemName(Long itemID)
	{
		if(item == null)
		{
			setItemID(itemID);
		}
		return item.getProductName();
	}


	public List<Auction> getAuctionsForItem(Long itemID) 
	{
		if(itemID != null)
		{
			return Auction.getAuctionsOfItem(itemID);
		}
		else
		{
			return new ArrayList<Auction>();
		}
	}
	
	public List<Auction> getLiveAuctionsForItem(Long itemID) 
	{
		if(itemID != null)
		{
			return Auction.getLiveAuctionsOfItem(itemID);
		}
		else
		{
			return new ArrayList<Auction>();
		}
	}
	
	public List<Auction> getExpiredAuctionsForItem(Long itemID) 
	{
		if(itemID != null)
		{
			return Auction.getExpiredAuctionsOfItem(itemID);
		}
		else
		{
			return new ArrayList<Auction>();
		}
	}
	
}
